import Link from "next/link";
import { type Footer as FooterType } from "@/base-framework/types/landing";

export default function Footer({ data }: { data?: FooterType }) {
  if (!data) return null;
  return (
    <footer className="w-full border-t border-black/10 dark:border-white/15 mt-16" aria-labelledby="footer-title">
      <div className="mx-auto max-w-screen-xl px-6 py-10 grid gap-4 sm:grid-cols-3">
        <h2 id="footer-title" className="sr-only">
          页脚
        </h2>
        <nav aria-label="快速链接" className="flex flex-col gap-2">
          {data.links?.map((l, i) => (
            <Link key={i} href={l.href} className="text-sm hover:underline underline-offset-4">
              {l.label}
            </Link>
          ))}
        </nav>
        <nav aria-label="法务" className="flex flex-col gap-2">
          {data.legal?.map((l, i) => (
            <Link key={i} href={l.href} className="text-sm hover:underline underline-offset-4">
              {l.label}
            </Link>
          ))}
        </nav>
        <nav aria-label="联系" className="flex flex-col gap-2">
          {data.contacts?.map((l, i) => (
            <Link key={i} href={l.href} className="text-sm hover:underline underline-offset-4">
              {l.label}
            </Link>
          ))}
        </nav>
      </div>
    </footer>
  );
}

